
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="_csrf" th:content="${_csrf.token}" />
<meta name="_csrf_header" th:content="${_csrf.headerName}" />
<link th:href="@{/static/bootstrap/css/bootstrap.min.css}"
	rel="stylesheet">
<link rel="stylesheet" th:href="@{/static/css/sb-admin-2.css}">
<link rel="stylesheet"
	th:href="@{/static/jquery-file-upload/css/jquery.fileupload.css}">
<link th:href="@{/static/codemirror/lib/codemirror.css}"
	rel="stylesheet">
<link th:href="@{/static/codemirror/addon/hint/show-hint.css}"
	rel="stylesheet">
<link th:href="@{/static/css/blog.css}" rel="stylesheet">
<link rel="stylesheet"
	th:href="@{/static/codemirror/addon/dialog/dialog.css}">
<link rel="stylesheet"
	th:href="@{/static/codemirror/addon/search/matchesonscrollbar.css}">
<!--[if lt IE 9]>
	  <script th:src="@{/static/js/html5shiv.min.js}"></script>
	  <script th:src="@{/static/js/respond.min.js}"></script>
	<![endif]-->

</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<div class="md-header btn-toolbar">
				<div class="btn-group" style="width: 98%">
					<button class="btn-default btn-sm btn" type="button"
						data-handler="file">文件</button>
					<button class="btn-default btn-sm btn" type="button"
						data-handler="localFile">本地文件</button>
					<button class="btn-default btn-sm btn" type="button"
						data-handler="clear">清空</button>
					<button class="btn-default btn-sm btn" type="button"
						data-handler="format">格式化</button>
					<button class="btn-default btn-sm btn" type="button"
						data-handler="lookup">查询</button>
					<button class="btn-default btn-sm btn" type="button"
						data-handler="lock">锁</button>
					<button class="btn-default btn-sm btn" type="button"
						data-handler="template">模板</button>
					<a class="btn-default btn-sm btn" target="_blank"
						th:href="@{/doc/index.html}">文档</a>
					<button class="btn-default btn-sm btn" type="button"
						data-toggle="modal" data-target="#backupModal">备份</button>
					<button class="btn-default btn-sm btn" type="button"
						data-handler="historyTemplate" th:if="${page.hasId()}">历史备份</button>
					<a class="btn-default btn-sm btn" type="button" data-toggle="modal"
						data-target="#previewModal">保存</a>
					<div
						style="text-align: right; float: right; line-height: 30px; font-weight: 600; right: 30px"
						id="auto-save-timer"></div>
				</div>
			</div>
			<textarea style="display: none" id="editor" th:text="${page.tpl}"></textarea>
		</div>
	</div>
	<div class="modal" id="lookupModal" tabindex="-1" role="dialog">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title">查询</h4>
				</div>
				<div class="modal-body">
					<ul id="myTab" class="nav nav-tabs" role="tablist">
						<li role="presentation" class="active"><a href="#dataTags"
							id="data-tab" role="tab" data-toggle="tab" aria-controls="home"
							aria-expanded="true">数据</a></li>
						<li role="presentation"><a href="#fragment" role="tab"
							id="fragment-tab" data-toggle="tab" aria-controls="profile">模板片段</a></li>
					</ul>
					<div class="tab-content">
						<div role="tabpanel" class="tab-pane fade in active" id="dataTags"
							aria-labelledby="data-tab"></div>
						<div role="tabpanel" class="tab-pane fade" id="fragment"
							aria-labelledby="fragment-tab"></div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>

	<div class="modal" id="lockModal" tabindex="-1" role="dialog">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title">锁</h4>
				</div>
				<div class="modal-body" id="lockBody"></div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>

	<div class="modal" id="templateModal" tabindex="-1" role="dialog">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title">模板</h4>
				</div>
				<div class="modal-body" id="templateModalBody"></div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>

	<div class="modal" id="backupModal" tabindex="-1" role="dialog">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title">备份</h4>
				</div>
				<div class="modal-body" id="backup-body"></div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>

	<div class="modal" id="previewModal" tabindex="-1" role="dialog">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title">保存</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal">
						<div class="form-group">
							<label class="col-sm-2 control-label">页面名称</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" th:value="${page.name}"
									id="name" /> <input type="text" style="display: none">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">页面别名</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" th:value="${page.alias}"
									id="alias" placeholder="1~30个字符,只能包含英文和数字以及-和_，不能为纯数字" /> <input
									type="text" style="display: none">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label"></label>
							<div class="col-sm-10">
								<label>作用于全部空间(除了默认空间)</label> <input type="checkbox" id="spaceGlobal"
									th:checked="${page.spaceGlobal ? 'checked' : null}" />
							</div>
						</div>
						<div class="form-group" >
							<label class="col-sm-2 control-label">所属空间</label>
							<div class="col-sm-10">
								<select class="form-control" id="spaceSelect">
									<option th:if="${page.space != null}"
										th:value="${page.space.id}" th:text="${page.space.name}"></option>
									<option value="">无</option>
									<option th:each="space : ${spaces}" th:value="${space.id}"
										th:text="${space.name}"></option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">描述</label>
							<div class="col-sm-10">
								<textarea rows="8" cols="8" class="form-control"
									id="description" th:text="${page.description}"></textarea>
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-10">
								<div class="checkbox">
									<label
										th:if="${page.allowComment == null || !page.allowComment}">
										<input type="checkbox" id="allowComment" />允许评论
									</label> <label
										th:if="${page.allowComment != null && page.allowComment}"><input
										type="checkbox" id="allowComment" checked="checked" />允许评论 </label>
								</div>
							</div>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="button" class="btn btn-primary" onclick="save()">保存</button>
					<button type="button" class="btn btn-primary" onclick="preview()">预览</button>
				</div>
			</div>
		</div>
	</div>

	<div class="modal fade modal-fullscreen" id="fsModal" tabindex="-1"
		role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="fsModalLabel"></h4>
				</div>
				<div class="modal-body">
					<iframe class="embed-responsive-item" src="" id="fs-url"
						style="position: absolute; top: 0px; left: 0px; bottom: 0px; right: 0px; width: 100%; border: none; margin: 0; padding: 0; overflow: hidden; z-index: 999999;"></iframe>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>

	<div class="modal " id="historyModal" tabindex="-1" role="dialog"
		aria-labelledby="queryModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title">历史模板</h4>
				</div>
				<div class="modal-body">
					<div class="container-fluid">
						<div id="history-tip"></div>
						<div class="table-responsive" id="historyTableContainer"></div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>

	<form style="display: none" id="tplForm">
		<input type="hidden"
			th:value="${page.space == null ? '' : page.space.id}" id="space">
		<input type="hidden" th:value="${page.id}" id="pageId">
	</form>
	<input type="hidden" th:value="'page_'+${page.id}" id="pageKey"
		th:if="${page.id != null}">
	<input type="hidden" id="pageKey" th:if="${page.id == null}">
	<div th:replace="base/foot_source"></div>
	<script th:src="@{/static/codemirror/lib/codemirror.js}"></script>
	<script th:src="@{/static/codemirror/addon/mode/overlay.js}"></script>
	<script th:src="@{/static/codemirror/mode/javascript/javascript.js}"></script>
	<script th:src="@{/static/codemirror/mode/css/css.js}"></script>
	<script th:src="@{/static/codemirror/mode/xml/xml.js}"></script>
	<script th:src="@{/static/codemirror/addon/edit/closetag.js}"></script>
	<script th:src="@{/static/codemirror/addon/fold/xml-fold.js}"></script>
	<script th:src="@{/static/codemirror/addon/hint/show-hint.js}"></script>
	<script th:src="@{/static/codemirror/addon/hint/xml-hint.js}"></script>
	<script th:src="@{/static/codemirror/addon/hint/html-hint.js}"></script>
	<script th:src="@{/static/codemirror/addon/hint/javascript-hint.js}"></script>
	<script th:src="@{/static/codemirror/mode/htmlmixed/htmlmixed.js}"></script>
	<script th:src="@{/static/codemirror/addon/dialog/dialog.js}"></script>
	<script th:src="@{/static/codemirror/addon/search/searchcursor.js}"></script>
	<script th:src="@{/static/codemirror/addon/search/search.js}"></script>
	<script
		th:src="@{/static/codemirror/addon/scroll/annotatescrollbar.js}"></script>
	<script
		th:src="@{/static/codemirror/addon/search/matchesonscrollbar.js}"></script>
	<script th:src="@{/static/codemirror/addon/search/jump-to-line.js}"></script>
	<script th:src="@{/static/js-beautify/beautify.min.js}"></script>
	<script th:src="@{/static/js-beautify/beautify-css.min.js}"></script>
	<script th:src="@{/static/js-beautify/beautify-html.min.js}"></script>
	<script type="text/javascript"
		th:src="@{/static/jquery-file-upload/js/load-image.min.js}"></script>
	<script type="text/javascript"
		th:src="@{/static/js/canvas-to-blob.min.js}"></script>
	<script
		th:src="@{/static/jquery-file-upload/js/vendor/jquery.ui.widget.js}"></script>
	<script
		th:src="@{/static/jquery-file-upload/js/jquery.iframe-transport.js}"></script>
	<script th:src="@{/static/jquery-file-upload/js/jquery.fileupload.js}"></script>
	<script
		th:src="@{/static/jquery-file-upload/js/jquery.fileupload-ui.js}"></script>
	<script
		th:src="@{/static/jquery-file-upload/js/jquery.fileupload-process.js}"></script>
	<script
		th:src="@{/static/jquery-file-upload/js/jquery.fileupload-image.js}"></script>
	<script
		th:src="@{/static/jquery-file-upload/js/jquery.fileupload-audio.js}"></script>
	<script
		th:src="@{/static/jquery-file-upload/js/jquery.fileupload-video.js}"></script>
	<script
		th:src="@{/static/jquery-file-upload/js/jquery.fileupload-validate.js}"></script>
	<script th:src="@{/static/js/modal.js}"></script>
	<script th:src="@{/static/js/clipboard.min.js}"></script>
	<script th:src="@{/static/js/local_storage.js}"></script>
	<script th:src="@{/static/js/mgr/editor_file.js}"></script>
	<script th:src="@{/static/js/mgr/static_file.js}"></script>
	<script th:src="@{/static/js/mgr/page_editor.js}"></script>
	<script th:src="@{/static/js/mgr/page_history.js}"></script>
	<script type="text/javascript"
		th:src="@{/static/js/bs-modal-fullscreen.min.js}"></script>
	<script type="text/javascript" th:src="@{/static/js/mgr/page_build.js}"></script>

</body>
</html>
